import 'dart:io';

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:image_cropper/image_cropper.dart';
import 'package:image_picker/image_picker.dart';

class Test extends StatefulWidget {
  @override
  TestPage createState() => TestPage();
}

class TestPage extends State<Test> with TickerProviderStateMixin {
  File? image;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text("TestPage"),
        ),
        body: Container(
          child: Column(
            children: [
              ElevatedButton(
                child: const Text("Choose"),
                style: ButtonStyle(minimumSize: MaterialStateProperty.all(Size(50, 40))),
                onPressed: () {
                  // ImagePicker().pickImage(source: ImageSource.gallery).then((value) {
                  //   ImageCropper.cropImage(sourcePath: value!.path, aspectRatio: CropAspectRatio(ratioX: 1, ratioY: 1)).then((value) {
                  //     setState(() {
                  //       image = value;
                  //     });
                  //   });
                  // });
                },
              ),

              getImage(),
            ],
          ),
        ));
  }

  getImage() {
    if(image!=null){
      return Image.file(File(image!.path));
    }else{
      return Text("234");
    }
  }
}
